package com.byjh.api;


import com.byjh.app.domain.Recruit;
import com.byjh.app.dto.RecruitSearchDto;
import com.byjh.app.service.IRecruitService;
import com.byjh.common.annotation.Anonymous;
import com.byjh.common.core.controller.BaseController;
import com.byjh.common.core.domain.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/api/recruit")
public class RecruitApi extends BaseController {


    @Resource
    private IRecruitService recruitService;


    @GetMapping("/list")
    @Anonymous
    public R<List<Recruit>> list(RecruitSearchDto dto) {
        return R.ok(recruitService.selectRecruitList(new Recruit().setName(dto.getKeyword())));
    }

    @GetMapping("/info/{id}")
    @Anonymous
    public R<Recruit> info(@PathVariable("id") Long id) {
        return R.ok(recruitService.selectRecruitById(id));
    }

}
